/* eslint-disable */
export const stringToArray = (str) => {
  str = str.trim();
  str.replace('[', '');
  str.replace(']', '');
  return str.split(',');
};


export const isEmpty = (num) => {
  return isNullOrUndefined(num) || num === '' || num.trim() === '';
}

export const isNullOrUndefined = (num) => {
  return num === null || num === undefined;
}

export const endWith = (str, s) => {
  if (isNullOrUndefined(str)) {
    return false;
  }
  str = str + '';
  if (s == null || s == "" || str.length == 0 || s.length > str.length)
    return false;
  if (str.substring(str.length - s.length) == s)
    return true;
  else
    return false;
  return true;
}

export const isEqual = (a, b) => {
  if (isNullOrUndefined(a) && isNullOrUndefined(b)) {
    return true;
  }
  if (isNullOrUndefined(a) || isNullOrUndefined(b)) {
    return false;
  }
  if (Array.isArray(a) && Array.isArray(b)) {
    if (a.length != b.length) {
      return false;
    }
    const size = a.length;
    for (let i = 0; i < size; i++) {
      if (!isEqual(a[i], b[i])) {
        return false;
      }
    }
    return true;
  } else if (typeof a == 'object' || typeof b == 'object') {
    for (let key in a) {
      if (a.hasOwnProperty(key)) {
        if (a[key] != b[key]) {
          return false;
        }
      }
    }
    return true;
  }
  return a == b;
}

